﻿using System;

namespace homework03_1
{
    class Program1
    {
        static void Main1()
        {
            // 示例数组
            int[] numbers = { 5, 2, 9, 1, 7, 6, 3 };

            // 初始化变量
            int max = numbers[0];
            int min = numbers[0];
            int sum = 0;

            // 遍历数组
            foreach (int num in numbers)
            {
                // 找最大值
                if (num > max)
                    max = num;

                // 找最小值
                if (num < min)
                    min = num;

                // 累加求和
                sum += num;
            }

            // 计算平均值
            double average = (double)sum / numbers.Length;

            // 输出结果
            Console.WriteLine("数组: " + string.Join(", ", numbers));
            Console.WriteLine($"最大值: {max}");
            Console.WriteLine($"最小值: {min}");
            Console.WriteLine($"平均值: {average}");
            Console.WriteLine($"总和: {sum}");
        }
    }
}
